package com.mz.ozy.widget;

import android.content.Context;
import android.media.MediaPlayer;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.widget.TextView;
import android.widget.VideoView;

import com.scwang.smartrefresh.layout.header.ClassicsHeader;

import java.lang.reflect.Field;

/**
 * 重写onMeasure 填满屏幕
 */

public class CustomHeaderView extends ClassicsHeader {

    public CustomHeaderView(Context context) {
        super(context);
        setUpdateState();
    }

    public CustomHeaderView(Context context, AttributeSet attrs) {
        super(context, attrs);
        setUpdateState();
    }

    public CustomHeaderView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        setUpdateState();
    }

    private void setUpdateState() {
        Field valueFieldString = null;
        try {
            valueFieldString = ClassicsHeader.class.getDeclaredField("mHeaderText");
            valueFieldString.setAccessible(true);
            TextView textView = (TextView) valueFieldString.get(this);
            textView.setTextSize(12);
        } catch (NoSuchFieldException | IllegalAccessException e) {
            e.printStackTrace();
        }
    }
}
